<template>
  <div>
    <div v-loading="loading" />
  </div>
</template>

<script>
import { mobileLoginApi } from '@/api/login'
export default {
  data() {
    return {
      loading: false,
      mobile: ''
    }
  },
  created() {
    console.log('Original mobile:', this.$route.query.mobile)
    console.log('Trimmed mobile:', this.$route.query.mobile.split(' ').join(''))
    this.mobile = this.$route.query.mobile.split(' ').join('')
    if (this.$route.query.mobile === 'null') {
      this.$message.error('您还没登录过OA系统')
      this.$router.push('/login')
    } else {
      this.loading = true
      // this.mobile = decodeURIComponent(this.$route.query.mobile)
      console.log(this.mobile)
      this.$store.dispatch('user/mobileLogin', {
        mobile: this.$route.query.mobile
      })
      this.loading = false
      // this.mobileLogin()
    }
  },
  methods: {
    async mobileLogin() {
      const res = await mobileLoginApi({
        mobile: this.$route.query.mobile
      })
      console.log(res)
    }
  }
}
</script>

<style scoped></style>
